// api/user.js
import request from "@/utils/request";
import qs from 'qs';

export const userInfoService = () => request.get('/api/user/userInfo.do');

export const userLogin = (data) => {
    const formData = qs.stringify(data);
    return request.post('/api/user/login.do', formData, {
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    });
};

export const userRegister = (data) => {
    const formData = qs.stringify(data);
    return request.post('/api/user/register.do', formData, {
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    });
};

export const updateUser = (userData) => {
    const formData = qs.stringify(userData);
    return request.post('/api/user/update.do', formData, {
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    });
};

export const updatePassword = (data) => {
    const formData = qs.stringify(data);
    return request.post('/api/user/updatePassword.do', formData, {
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    });
};


export function getWalletInfo() {
    return request({
        url: '/api/user/wallet/info.do',
        method: 'get'
    });
}